﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SLA.aspx.cs" Inherits="PMP.Reports.SLA" %>

<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>SLA -Service Level Agreement (Due Date Management) </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
<asp:GridView ID="grvSLA" runat="server" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
            ForeColor="#333333" GridLines="None" 
            onsorted="grvSLA_Sorted">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:BoundField DataField="Status" HeaderText="Status" 
                    SortExpression="Status" />
                <asp:BoundField DataField="Responsible" HeaderText="Responsible" 
                    ReadOnly="True" SortExpression="Responsible" />
                <asp:BoundField DataField="DueDate" HeaderText="DueDate" 
                    SortExpression="DueDate" />
                <asp:BoundField DataField="RemainDays" HeaderText="RemainDays" ReadOnly="True" 
                    SortExpression="RemainDays" />
                <asp:BoundField DataField="pkey" HeaderText="pkey" SortExpression="pkey" 
                    Visible="False" />
                <asp:HyperLinkField DataNavigateUrlFields="pkey" 
                    DataNavigateUrlFormatString="http://jira.redprairie.com/browse/{0}" 
                    DataTextField="pkey" HeaderText="pkey" Text="pkey" />
                <asp:BoundField DataField="reporter" HeaderText="reporter" 
                    SortExpression="reporter" />
                <asp:BoundField DataField="assignee" HeaderText="assignee" 
                    SortExpression="assignee" />
                <asp:BoundField DataField="type" HeaderText="type" SortExpression="type" />
                <asp:BoundField DataField="priority" HeaderText="priority" 
                    SortExpression="priority" />
                <asp:BoundField DataField="summary" HeaderText="summary" 
                    SortExpression="summary" />
                <asp:BoundField DataField="created" HeaderText="created" 
                    SortExpression="created" />
                <asp:BoundField DataField="updated" HeaderText="updated" 
                    SortExpression="updated" />
                <asp:BoundField DataField="Origin" HeaderText="Origin" ReadOnly="True" 
                    SortExpression="Origin" />
                <asp:BoundField DataField="Spent" HeaderText="Spent" ReadOnly="True" 
                    SortExpression="Spent" />
                <asp:BoundField DataField="Remain" HeaderText="Remain" ReadOnly="True" 
                    SortExpression="Remain" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="AccessDefects" runat="server" ConnectionString="<%$ ConnectionStrings:jira_reportingConnectionString %>" 
            
            
            
            
            SelectCommand=" select * from (select sts.pname Status,         Case sts.pname                   when 'Open' then ji.assignee           when 'Assigned' then ji.assignee           when 'In Progress' then ji.assignee           when 'review' then cf.stringvalue           when 'Need More Information' then ji.reporter           when 'Needs Merge' then cf1.stringvalue           when 'Needs Commit' then cf1.stringvalue           when 'Missing Details' then ji.reporter           when 'Rework' then ji.assignee           when 'Hold' then ''           when 'In Progress' then ji.assignee           when 'Reopened' then ji.assignee       else ji.assignee end as Responsible,       ji.duedate DueDate,       datediff(day, (getDate()+13.0/24), ji.duedate) as RemainDays,       ji.pkey, ji.reporter, ji.assignee, it.pname as type, pr.pname as priority, ji.summary, ji.created, ji.updated, ji.timeoriginalestimate/3600 as Origin, ji.timespent/3600 as Spent, ji.timeestimate/3600 as Remain  from jiraissue ji join issuetype it on ji.issuetype = it.id  join issuestatus sts    on ji.issuestatus = sts.ID  left outer join customfieldvalue cf    on cf.customfield = '10000'   and cf.issue = ji.id  left outer join customfieldvalue cf1    on cf1.customfield = '10022'   and cf1.issue = ji.id  join priority pr    on ji.priority = pr.ID where ji.issuestatus in ('1','3','4','10000','10002','10003','10004','10005','10006','10007','10008')) result where result.assignee in ('azhang','caliu','kdai','kelzhu','mji','nliu','pyang','rban','rwei','toshi','twang','vpang') and (DueDate &lt;&gt; '' or DueDate &lt;&gt; null) order by RemainDays, result.Responsible,  Status, assignee, type" UpdateCommand="update config
set currentSprint = @currentSprint,
VincentCapacity = @VincentCapacity,
KimCapacity = @KimCapacity,
SprintStart = @SprintStart,
NextSprint= @NextSprint,
VincentCapacity_NextSprint = @VincentCapacity_NextSprint,
KimCapacity_NextSprint = @KimCapacity_NextSprint,
SprintStart_NextSprint = @SprintStart_NextSprint
where ID  = @ID">
            <UpdateParameters>
                <asp:Parameter Name="currentSprint" />
                <asp:Parameter Name="VincentCapacity" />
                <asp:Parameter Name="KimCapacity" />
                <asp:Parameter Name="SprintStart" />
                <asp:Parameter Name="NextSprint" />
                <asp:Parameter Name="VincentCapacity_NextSprint" />
                <asp:Parameter Name="KimCapacity_NextSprint" />
                <asp:Parameter Name="SprintStart_NextSprint" />
                <asp:Parameter Name="ID" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
